<template>
    <div class="box">
        <div class="detBox">
            <el-row>
                <el-col :span="24">
                    <div class="grid-content bg-purple">
                        <div class="btitle">{{$t('comreginf')}}</div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhead">{{$t('mertid')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bbody">{{result.merId}}</div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhead">{{$t('tpofenter')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bbody">{{result1.enterpriseType}}</div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhead">{{$t('efftim')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bbody">{{gmtCrea}}</div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhead">{{$t('mertnam')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bbody">{{result.merName}}</div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhead">{{$t('mersta')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bbody">{{status}}</div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhead">{{$t('regnumber')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bbody">{{result.creditCode}}</div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhimg">{{$t('regfilepic')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bdimg">
                            <el-image :src="result1.cacRegisterImgPath" :preview-src-list="getSrcList(4)"></el-image>
                        </div>
                    </div>
                </el-col>
            </el-row>
        </div>
        <div class="detBox">
            <el-row>
                <el-col :span="24">
                    <div class="grid-content bg-purple">
                        <div class="btitle">{{$t('rsperinf')}}</div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhimg">{{$t('cacdirpage')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bdimg">
                            <el-image :src="result1.cacPrincipalImgPath" :preview-src-list="getSrcList(3)"></el-image>
                        </div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhimg">{{$t('diridcardone')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bdimg">
                            <el-image :src="result.firstPartnerCertImg" :preview-src-list="getSrcList(0)"></el-image>
                        </div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhead">{{$t('doctype')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bbody">{{result.firstPartnerCertType}}</div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhimg">{{$t('diridcardtwo')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bdimg">
                            <el-image :src="result.lastPartnerCertImg" :preview-src-list="getSrcList(1)"></el-image>
                        </div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhead">{{$t('doctype')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bbody">{{result.lastPartnerCertType}}</div>
                    </div>
                </el-col>
            </el-row>
        </div>
        <div class="detBox">
            <el-row>
                <el-col :span="24">
                    <div class="grid-content bg-purple">
                        <div class="btitle">{{$t('buscate')}}</div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhead">{{$t('buscate')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bbody">{{result.business}}</div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhead">{{$t('connumber')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bbody">{{result1.mobile}}</div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhead">{{$t('eml')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bbody">{{result1.email}}</div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhking">{{$t('offbusadd')}}</div>
                    </div>
                </el-col>
                <el-col :span="8">
                    <div class="grid-content bg-purple-light">
                        <div class="bbking">
                            <div>{{result1.address}}</div>
                        </div>
                    </div>
                </el-col>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhking">{{$t('offwebaddress')}}</div>
                    </div>
                </el-col>
                <el-col :span="8">
                    <div class="grid-content bg-purple-light">
                        <div class="bbking">
                            <div>{{result1.websiteAddress}}</div>
                        </div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhimg">{{$t('cacbusncatedocupage')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bdimg">
                            <el-image :src="result1.cacCategoryImgPath" :preview-src-list="getSrcList(2)"></el-image>
                        </div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhead">{{$t('socialmedaddrs1')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bbody">{{socialMedia1}}</div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhead">{{$t('socialmedaddrs2')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bbody">{{socialMedia2}}</div>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="4">
                    <div class="grid-content bg-purple">
                        <div class="bhead">{{$t('socialmedaddrs3')}}</div>
                    </div>
                </el-col>
                <el-col :span="20">
                    <div class="grid-content bg-purple-light">
                        <div class="bbody">{{socialMedia3}}</div>
                    </div>
                </el-col>
            </el-row>
        </div>
    </div>
</template>

<script>
import {
    getmerprobifdetlist,
    getMerforBaseInfo
} from '@/libs/reqlist.js'
export default {
    data () {
        return {
            // 查询条件
            merId: '',
            status: null,
            gmtCrea: null,
            result: {},
            result1: {},
            socialMedia1: null,
            socialMedia2: null,
            socialMedia3: null,
            imageList: []
        }
    },
    methods: {
        // 查询功能
        seachBaseInfo () {
            getmerprobifdetlist(JSON.stringify({ merId: this.merId })).then(res => {
                if (res.data.code === '000000') {
                    this.result = res.data.data
                    if (this.result.firstPartnerCertType === 'Test certType') this.result.firstPartnerCertType = this.$t('testype')
                    if (this.result.lastPartnerCertType === 'Test certType') this.result.lastPartnerCertType = this.$t('testype')
                    if (this.result.firstPartnerCertType === 'ID_CARD') this.result.firstPartnerCertType = this.$t('idcard')
                    if (this.result.lastPartnerCertType === 'ID_CARD') this.result.lastPartnerCertType = this.$t('idcard')
                    if (this.result.firstPartnerCertType === 'PASSPORT') this.result.firstPartnerCertType = this.$t('passport')
                    if (this.result.lastPartnerCertType === 'PASSPORT') this.result.lastPartnerCertType = this.$t('passport')
                    this.imageList.push(this.result.firstPartnerCertImg)
                    this.imageList.push(this.result.lastPartnerCertImg)
                }
            })
            getMerforBaseInfo(JSON.stringify({ merId: this.merId })).then(res => {
                if (res.data.code === '000000') {
                    this.result1 = res.data.data
                    if (this.result1.enterpriseType === 'BIG_MER') this.result1.enterpriseType = this.$t('bigbusinesses')
                    if (this.result1.enterpriseType === 'PERSONAL') this.result1.enterpriseType = this.$t('enterprise')
                    if (this.result1.enterpriseType === 'ENTERPRISE') this.result1.enterpriseType = this.$t('indbusinesses')
                    this.imageList.push(this.result1.cacCategoryImgPath)
                    this.imageList.push(this.result1.cacPrincipalImgPath)
                    this.imageList.push(this.result1.cacRegisterImgPath)
                    this.socialMedia1 = this.result1.socialMediaList[0]
                    this.socialMedia2 = this.result1.socialMediaList[1]
                    this.socialMedia3 = this.result1.socialMediaList[2]
                }
            })
        },
        getSrcList (index) {
            return this.imageList.slice(index).concat(this.imageList.slice(0, index))
        }
    },
    mounted () {
        // 全局商户id
        this.merId = window.sessionStorage.getItem('merId')
        this.status = window.sessionStorage.getItem('merStatus')
        if (window.sessionStorage.getItem('mercretime') !== 'undefined') {
            this.gmtCrea = window.sessionStorage.getItem('mercretime')
        } else {
            this.gmtCrea = ''
        }
        this.seachBaseInfo()
    }
}
</script>

<style lang="less" scoped>
@import './baseInfo.less';
</style>
